# 第一阶段：代码克隆和构建
FROM maven:3.9.6-eclipse-temurin-21-alpine AS builder
# 构建应用
WORKDIR /app
COPY pom.xml .
RUN mvn clean package -DskipTests

# 第二阶段：运行环境
FROM eclipse-temurin:21-jre-alpine

WORKDIR /app
COPY --from=builder /app/target/*.jar ./app.jar

EXPOSE 8080  # 根据实际端口调整
ENTRYPOINT ["java", "-jar", "app.jar"]